﻿/********************************************************************************
 * Developed by Phil Tyler (http://www.laidbackcoder.co.uk)
 * 
 * Cryptosolic is Licensed under the GNU Lesser General Public License (LGPL)
 * http://cryptosolic.codeplex.com/license
 * *****************************************************************************/
using System;
using System.Text;
using Cryptosolic.Utilities;

namespace Cryptosolic.Security
{
    /// <summary>
    /// Used to Store Outputted Hashed or Encrypted Data
    /// </summary>
    public class CipherText
    {
        internal byte[] CipherBytes;

        /// <summary>
        /// Cipher Text
        /// </summary>
        /// <param name="cipherBytes">Data as a Byte Array</param>
        public CipherText(byte[] cipherBytes)
        {
            this.CipherBytes = cipherBytes;
        }

        /// <summary>
        /// Return Data as a Text String
        /// </summary>
        /// <returns>Secure Data</returns>
        public override string ToString()
        {
            return DataConverter.BytesToString(this.CipherBytes);
        }

        /// <summary>
        /// Return Data as a Hex String
        /// </summary>
        /// <returns>Secure Data</returns>
        public string ToHex()
        {
			return DataConverter.BytesToHex(this.CipherBytes);
        }

        /// <summary>
        /// Return Data as a Byte Array
        /// </summary>
        /// <returns>Secure Data</returns>
        public virtual byte[] ToBytes()
        {
            return this.CipherBytes;
        }
    }
}
